/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.model.service;

import com.model.domain.comun.Configuracion;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

/**
 *
 * @author Rdelacruz
 */
public class ConfiguracionService 
extends AbstractService
{             
        
    public String findPropertyByCodigo(Connection con, String codigo) throws Exception {
        Configuracion c = findByCodigo(con,codigo);
        if(c==null)
            return null;
        return c.getValor();
    }
        
    public Configuracion findByCodigo(Connection con, String codigo) throws Exception {
        Statement st = null;
        try {            
            
            st = con.createStatement();
            ResultSet rs = st.executeQuery("select codigo, valor from Configuracion where codigo='"+codigo+"'");
                       
            if(rs.next()) {                
                Configuracion c = new Configuracion();
                c.setCodigo(rs.getString("codigo"));
                c.setValor(rs.getString("valor"));                
                return c;
            }
        }
        finally {
            if(st!=null) st.close();                        
        }
        return null;
    }
    
    
    
}
